let { getsOrders, confirmAlterOrders, deleteOrders } = require('../dao/ordersDao');
//页面渲染
module.exports.getsOrders = async () => {
    let data = await getsOrders();
    if (data) {
        return {
            msg: '获取成功',
            code: 1,
            data
        }
    } else {
        return {
            msg: '获取失败',
            code: 0,
        }
    };
};

//修改订单
module.exports.confirmAlterOrders = async (result) => {
    let data = await confirmAlterOrders(result);
    if (data) {
        return {
            code: 1,
            msg: '修改成功',
            data
        }
    }
    return {
        code: 0,
        msg: '修改失败',
    }
};

// 删除订单
module.exports.deleteOrders = async function (_id) {
    let data = await deleteOrders(_id)
    if (data.deletedCount) {
        return {
            code: 1,
            msg: '删除成功',
            data
        }
    } else {
        return {
            code: 0,
            msg: '删除失败',
        }
    }
}